Skip to main content

Upsert Seed Models for Provider

Used to create or update the seed models data for a specific AI provider. This endpoint allows you to add new models or update existing model specifications in the seed collection.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/models/seed/providers/{provider}/models

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/models/seed/providers/openai/models' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '[
{
"Model": "gpt-4-turbo-preview",
"ModelGoodName": "GPT-4 Turbo",
"MaxTokens": 4096,
"DefaultTemp": 0.7,
"ContextLength": 128000,
"InputCostPerMillion": 10.0,
"OutputCostPerMillion": 30.0
},
{
"Model": "gpt-3.5-turbo",
"ModelGoodName": "GPT-3.5 Turbo",
"MaxTokens": 4096,
"DefaultTemp": 0.7,
"ContextLength": 16385,
"InputCostPerMillion": 0.5,
"OutputCostPerMillion": 1.5
}
]'

Path Parameters

FieldTypeRequiredDescription
providerstringYesProvider name (case-insensitive). Examples: "openai", "anthropic", "azure", "google".

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
Content-Typeapplication/jsonYesData type, must be application/json.

Request Body

Request Body Schema

[
{
"Model": "string",
"ModelGoodName": "string",
"MaxTokens": 0,
"DefaultTemp": 0,
"ContextLength": 0,
"InputCostPerMillion": 0,
"OutputCostPerMillion": 0
}
]

Request Body Parameters

FieldTypeRequiredDescription
ModelstringYesExact model identifier used in API calls (e.g., "gpt-4-turbo-preview").
ModelGoodNamestringYesHuman-readable display name for the model (e.g., "GPT-4 Turbo").
MaxTokensintegerYesMaximum number of tokens the model can generate in a single response.
DefaultTempnumberYesDefault temperature setting for the model (typically 0-2).
ContextLengthintegerYesMaximum context window size in tokens (input + output).
InputCostPerMillionnumberYesCost per million input tokens in USD.
OutputCostPerMillionnumberYesCost per million output tokens in USD.
note

Upsert Behavior

This endpoint performs an upsert operation:

  • Create: If a model with the given Model identifier doesn't exist, it will be created
  • Update: If a model with the given Model identifier already exists, it will be updated with the new values
  • Replace: The entire models array for the provider is replaced, so include all models you want to keep

Provider-Specific Considerations:

  • Ensure model names match the exact identifiers used by the provider's API
  • Cost values should reflect current pricing from the provider
  • Context length should account for both input and output tokens
  • Temperature ranges may vary by provider (most use 0-2, some use 0-1)
tip

Best practices for upserting seed models:

  • Batch updates: Include all models in a single request to maintain consistency
  • Accurate pricing: Regularly update cost information to reflect provider changes
  • Version tracking: Use descriptive ModelGoodName values to differentiate versions
  • Validation: Test model configurations after upserting
  • Documentation: Keep records of when and why seed data was updated

Temperature guidelines by use case:

  • 0.0-0.3: Factual, deterministic responses (documentation, data extraction)
  • 0.4-0.7: Balanced creativity and consistency (general chat, Q&A)
  • 0.8-1.0: Creative content (writing, brainstorming)
  • 1.1-2.0: Highly experimental (not recommended for most use cases)

Cost calculation example:

  • Input: 1M tokens at $10/M = $10.00
  • Output: 500K tokens at $30/M = $15.00
  • Total cost: $25.00 for the interaction

Response

Success Response (200 OK)

Returns an object confirming the upsert operation.

{
"success": true,
"provider": "openai",
"models_updated": 2,
"timestamp": "2025-01-12T10:30:00Z"
}

Response Fields

FieldTypeDescription
-objectFlexible response object (additionalProp1: {}) containing operation details. Typically includes success status, provider name, and count of models updated.
note

Response Object Structure

The actual response structure may vary but typically includes:

  • Operation success status
  • Provider name that was updated
  • Number of models created or updated
  • Timestamp of the operation
  • Any warnings or validation messages

Error Response (422 Unprocessable Entity)

Returns validation error details when the request body is invalid or the provider doesn't exist.

{
"detail": [
{
"loc": [
"body",
0,
"MaxTokens"
],
"msg": "MaxTokens must be a positive integer",
"type": "value_error.number.not_gt"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., body, field index).
msgstringHuman-readable error message.
typestringError type identifier.

Common Error Scenarios

Error TypeDescriptionResolution
Provider Not FoundThe specified provider doesn't exist in the systemCreate the provider first or verify provider name
Invalid Model FormatModel identifier contains invalid charactersUse alphanumeric characters, hyphens, and underscores only
Missing Required FieldOne or more required fields are missingEnsure all required fields are included in each model object
Invalid Number RangeMaxTokens, DefaultTemp, or costs are out of valid rangeCheck value constraints (e.g., DefaultTemp typically 0-2)
Duplicate Model NamesMultiple models with the same Model identifierEnsure Model identifiers are unique within the array
Invalid Cost ValuesNegative or non-numeric cost valuesProvide valid positive numbers for cost fields

Error Codes

Status CodeDescriptionResponse Type
200OK - Models upserted successfullySuccess
400Bad Request - Invalid request formatBad Request
404Not Found - Provider doesn't existNot Found
422Validation Error - Invalid model dataUnprocessable Entity
500Internal Server Error - Failed to upsert modelsInternal Server Error
warning

Important Considerations

  • This operation replaces the entire models array for the provider
  • Always include all models you want to keep, not just new ones
  • Upserted seed data affects all users and projects in the system
  • Changes take effect immediately and impact model selection UI
  • Incorrect pricing data can lead to inaccurate cost estimates
  • Test thoroughly in a non-production environment first
  • Keep audit logs of seed data changes
  • Coordinate with team before modifying shared seed data
  • Consider backwards compatibility when updating model identifiers
  • Provider API changes may require seed data updates